package ai

import "fmt"

func display(board *TypeRepo[TypeRole], tips ...interface{}) {
	size := board.size
	gap := "  "
	result := " " + gap
	start := 0
	if board.Get(0, 0) == Chess.OBSTACLE {
		start = 1
	}
	for i := start; i < size-start; i++ {
		result += fmt.Sprintf("%X%v", i-start, gap)
	}
	result += "\n"
	for i := start; i < size-start; i++ {
		result += fmt.Sprintf("%X%v", i-start, gap)
		for j := start; j < size-start; j++ {
			switch board.Get(j, i) {
			case Chess.BLACK:
				result += "X" + gap
			case Chess.WHITE:
				result += "O" + gap
			default:
				result += "-" + gap
			}
		}
		result += "\n"
	}
	for _, tip := range tips {
		fmt.Println(tip)
	}
	fmt.Println(result)
}

func displayScores(board *TypeRepo[int], tips ...interface{}) {
	size := board.size
	gap := "    "
	result := " " + gap
	for i := 0; i < size; i++ {
		result += fmt.Sprintf("%X%v", i, gap)
	}
	result += "\n"
	for i := 0; i < size; i++ {
		result += fmt.Sprintf("%X%v", i, gap)
		for j := 0; j < size; j++ {
			result += fmt.Sprintf("%v%v", board.Get(j, i), gap)
		}
		result += "\n"
	}
	for _, tip := range tips {
		fmt.Println(tip)
	}
	fmt.Println(result)
}
